/**
 * 
 */
package com.lanswon.qzsmk.service.appManageService.impl;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.UnavailableSecurityManagerException;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.fastjson.JSONObject;
import com.lanswon.qzsmk.exception.ApplicationException;
import com.lanswon.qzsmk.annotation.SystemServiceLog;
import com.lanswon.qzsmk.base.AccountContants;
import com.lanswon.qzsmk.base.AppContants;
import com.lanswon.qzsmk.base.BlackListContants;
import com.lanswon.qzsmk.base.CardContants;
import com.lanswon.qzsmk.base.DwzPage;
import com.lanswon.qzsmk.base.HttpContants;
import com.lanswon.qzsmk.dao.AppClassificationMapper;
import com.lanswon.qzsmk.dao.AppKindMapper;
import com.lanswon.qzsmk.dao.AppOpenRegMapper;
import com.lanswon.qzsmk.dao.BikeSectionMapper;
import com.lanswon.qzsmk.dao.BlackListGenMapper;
import com.lanswon.qzsmk.dao.BlackListRcMapper;
import com.lanswon.qzsmk.dao.BusinessMapper;
import com.lanswon.qzsmk.dao.CardArchiveMapper;
import com.lanswon.qzsmk.dao.CardControlMapper;
import com.lanswon.qzsmk.dao.CardDataMapper;
import com.lanswon.qzsmk.dao.CardTypeMapper;
import com.lanswon.qzsmk.dao.CertMapper;
import com.lanswon.qzsmk.dao.FeeRulesMapper;
import com.lanswon.qzsmk.dao.MainAccountPersonalMapper;
import com.lanswon.qzsmk.dao.PersonalMapper;
import com.lanswon.qzsmk.dao.SubaccountPersonalMapper;
import com.lanswon.qzsmk.model.ActiveUser;
import com.lanswon.qzsmk.model.AppClassification;
import com.lanswon.qzsmk.model.AppKind;
import com.lanswon.qzsmk.model.AppOpenReg;
import com.lanswon.qzsmk.model.BikeSection;
import com.lanswon.qzsmk.model.BlackListGen;
import com.lanswon.qzsmk.model.BlackListRc;
import com.lanswon.qzsmk.model.Business;
import com.lanswon.qzsmk.model.CardControl;
import com.lanswon.qzsmk.model.CardData;
import com.lanswon.qzsmk.model.CardType;
import com.lanswon.qzsmk.model.Cert;
import com.lanswon.qzsmk.model.FeeRules;
import com.lanswon.qzsmk.model.MainAccountPersonal;
import com.lanswon.qzsmk.model.Personal;
import com.lanswon.qzsmk.model.SubaccountPersonal;
import com.lanswon.qzsmk.model.TxnDtl;
import com.lanswon.qzsmk.service.preService.BikeService;
import com.lanswon.qzsmk.service.preService.impl.BikeServiceImpl;
import com.lanswon.qzsmk.service.appManageService.AppOpenRegService;
import com.lanswon.qzsmk.util.CommonUtil;
import com.lanswon.qzsmk.util.CopyBean;
import com.lanswon.qzsmk.util.SequenceNumberUtil;
import com.lanswon.qzsmk.vo.AcountDetailVo;
import com.lanswon.qzsmk.vo.AppOpenInfoVo;
import com.lanswon.qzsmk.vo.AppOpenRegVo;
import com.lanswon.qzsmk.vo.CardInfoAndCustomerInfo;
import com.lanswon.qzsmk.vo.FeeRulesVo;
import com.lanswon.qzsmk.vo.VoucherVo;

import ch.qos.logback.classic.Logger;
/**
 * Day
 *
 *
 */
@Service
public  class AppOpenRegServiceImpl implements AppOpenRegService{
	
	private final static Logger logger = (Logger) LoggerFactory.getLogger(AppOpenRegServiceImpl.class);
	// 应用分类定义表映射
	@Autowired
	AppClassificationMapper mcd;
  //卡应用开通表映射
	@Autowired
	AppOpenRegMapper aorm;
    //应用类型定义表映射
	@Autowired
	AppKindMapper akm;
	
	@Autowired
	SubaccountPersonalMapper spm;
	
	@Autowired
	CardDataMapper cdm;
	
	@Autowired
	PersonalMapper pm;
	
	@Autowired
	MainAccountPersonalMapper mapm;
	//卡数据表映射
	@Autowired
	CardDataMapper cd;
	//卡档案表映射
	@Autowired
	CardArchiveMapper cam;
	
	//凭证映射
	@Autowired
	CertMapper  cmr;
	//卡控制表映射
	@Autowired
	CardControlMapper ccm;
	//卡收费规则表
	@Autowired
	FeeRulesMapper frm;
	//通过市民卡号查询卡应用分类、应用类型、应用状态、有效期(起)、有效期(止)
	
	@Autowired
	BikeService bikeService;
	
	@Autowired
	CardControlMapper cardControlMapper;
	
	@Autowired
	CertMapper certMapper;
	
	@Autowired
	BusinessMapper businessMapper;
	
	@Autowired
	CardTypeMapper cardTypeMapper;
	
	@Autowired
	BikeSectionMapper bikeSectionMapper;
	
	@Autowired
	BlackListGenMapper blgm;
	
	@Autowired
	BlackListRcMapper blrm;
	
	@Autowired
	FeeRulesMapper feeRulesMapper;
	
	@Override
	public DwzPage<AppOpenRegVo> queryAppOpenRegByCodeKindname(String citizenCardNo,String Status,AppOpenRegVo sci, String appKindName,String remark1,String remark2) 
	{
		List<AppOpenReg> list = aorm.queryAppOpenRegStopByCitizenCardNo(sci.getCitizenCardNo());
		System.out.println(list                +"dddddd"   +"这个是所查询出来的数据，你懂得 "     );
		List<AppOpenRegVo>lists=new ArrayList<>();
		//List<AppOpenReg>  sm=js.queryAppOpenRegByRemark(citizenCardNo, remark1, remark2);
       for(AppOpenReg app:list)
       {
    	   AppKind ak=akm.queryAppKindByTypeCode(Integer.valueOf(app.getAppType()));
    	   app.setAppType(ak.getAppName()); 
    	   app.setAppStatus("停用");
    	   app.setAppStatus("开通");
    	   AppOpenRegVo appVo=new AppOpenRegVo();
    	   appVo=(AppOpenRegVo) CopyBean.copyA2b(app, appVo);
    	   appVo.setAppKindName(mcd.queryAppClassificationByAppKindId(ak.getAppKindId()).getAppKindName());
    	   
    	   lists.add(appVo);
       }
       int totalCount =  aorm.countByExample(citizenCardNo);
		DwzPage<AppOpenRegVo> dp = new DwzPage<AppOpenRegVo>(sci.getCurrentPage(),
				sci.getNumPerPage(), totalCount);
		dp.setList(lists);
		return dp;
	}
	
	@Override
	public String checkOpenByStop(Date ValidBegin, Date getValidEnd) {
		
		Date now=new Date();
		Calendar cNow=Calendar.getInstance();
		cNow.setTime(now);
		Calendar cStart=Calendar.getInstance();
		cStart.setTime(ValidBegin);
		Calendar cEnd=Calendar.getInstance();
		cEnd.setTime(getValidEnd);
		if(cNow.after(cStart)&&cNow.before(cEnd)){
			return "1";
		}else {
			return "0";
		}
	}

	/*
	 * 获取卡类型分类名称公交应用、小额消费应用、社保应用、卫生应用等等
	 */
	
	public List<AppClassification> queryAppClassificationsKindname (){
		return mcd.queryAppClassification();
	}
    /*提交卡应用开通*/
	@Override
	public AppOpenReg CommitAppOpen (String appKindName,String citizenCardNo,String cardsn) throws ApplicationException{
		ActiveUser activeUser = null;
		try {
			activeUser = (ActiveUser) SecurityUtils.getSubject().getSession().getAttribute("activeUser");

		} catch (UnavailableSecurityManagerException e) {
			e.printStackTrace();
			activeUser = new ActiveUser();
			activeUser.setUserName("用户");
			activeUser.setLoginName("用户");
			activeUser.setBranchName("互联网端");
			activeUser.setBranchNo("99999999");
			activeUser.setUserNo(99999999);
			activeUser.setUserId(99999999);
		}
		
		if(activeUser == null){
			activeUser = new ActiveUser();
			activeUser.setUserName("用户");
			activeUser.setLoginName("用户");
			activeUser.setBranchName("互联网端");
			activeUser.setBranchNo("99999999");
			activeUser.setUserNo(99999999);
			activeUser.setUserId(99999999);
		}
		   Date date=new  Date();
			//创建卡应用开通表对象
			AppOpenReg   aop=new AppOpenReg();
			aop.setAppStatus(AppContants.APP_STATUS_CLOSE);
			aop.setCitizenCardNo(aop.getCitizenCardNo());
		   aop.setCrtDate(new Date());
		   aop.setAppType(aop.getAppType());
		   if(AppContants.APP_STATUS_CLOSE.equals(aop.getAppStatus()))
		   {
			   //插入
			   aop.setAppStatus(AppContants.APP_STATUS_OPEN);
			   aop.setAppType("3");
			   aop.setCrtOperator("小美");
			  aop .setLastOperator("小人儿");
			  aop.setValidBegin(aop.getValidBegin());
			  aop.setValidEnd(aop.getValidEnd());
			   aop.setRemark(aop.getRemark());
			   aop.setCitizenCardNo(aop.getCitizenCardNo());
			   aop.setIsValid("有");
			   aorm.insert(aop);
		   }
		    //创建凭证对象
		   Cert  ce=new Cert();

		   //生成凭证号
		    ce.setCertNo(SequenceNumberUtil.generatorCertNo());
		   ce.setCertNo(ce.getCertNo());

		   ce.setCertNo(SequenceNumberUtil.generatorCertNo());
	       ce.setCardControlId(ce.getCardControlId());
	       ce.setAgentName(ce.getAgentName());
	       ce.setAgentPaperNo(ce.getAgentPaperNo());
	       ce.setAgentPapertype(ce.getAgentPapertype());
	       ce.setBranchNo(ce.getBranchNo());
	       ce.setCrtOperator(activeUser.getUserNo().toString());
			ce.setCrtDate(date);
			ce.setLastOperator(activeUser.getUserNo().toString());
		    ce.setLastDate(date);
	       cmr.insert(ce);
 
	       AppOpenReg ar=(AppOpenReg) bikeService.openBikeApp(appKindName, appKindName);
	       
		return aop; 
	       
	       
	       
	         
			
	}
public AppOpenReg CommitAppStop (String appkindName,String citizenCardNo,String cardsn) throws ApplicationException{
	ActiveUser activeUser = null;
	try {
		activeUser = (ActiveUser) SecurityUtils.getSubject().getSession().getAttribute("activeUser");

	} catch (UnavailableSecurityManagerException e) {
		e.printStackTrace();
		activeUser = new ActiveUser();
		activeUser.setUserName("用户");
		activeUser.setLoginName("用户");
		activeUser.setBranchName("互联网端");
		activeUser.setBranchNo("99999999");
		activeUser.setUserNo(99999999);
		activeUser.setUserId(99999999);
	}
	
	if(activeUser == null){
		activeUser = new ActiveUser();
		activeUser.setUserName("用户");
		activeUser.setLoginName("用户");
		activeUser.setBranchName("互联网端");
		activeUser.setBranchNo("99999999");
		activeUser.setUserNo(99999999);
		activeUser.setUserId(99999999);
	}
	 Date date=new  Date();
		//创建卡应用开通表对象
		AppOpenReg   aop=new AppOpenReg();
		aop.setAppStatus(AppContants.APP_STATUS_OPEN);
		aop.setCitizenCardNo(aop.getCitizenCardNo());
	   aop.setCrtDate(new Date());
	   aop.setAppType(aop.getAppType());
	   if(AppContants.APP_STATUS_OPEN.equals(aop.getAppStatus()))
	   {
		   //更改卡应用状态
		   aop.setAppStatus(AppContants.APP_STATUS_CLOSE);
		   aop.setAppType("3");
		   aop.setCrtOperator("小美");
		  aop .setLastOperator("小人儿");
		  aop.setValidBegin(aop.getValidBegin());
		  aop.setValidEnd(aop.getValidEnd());
		   aop.setRemark(aop.getRemark());
		   aop.setCitizenCardNo(aop.getCitizenCardNo());
		   aop.setIsValid("有");
		   aorm.update(aop);
	   }
	    //创建凭证对象
	   Cert  ce=new Cert();
	   //生成凭证号
    ce.setCertNo(SequenceNumberUtil.generatorCertNo());
	ce.setCertNo(SequenceNumberUtil.generatorCertNo());
    ce.setCardControlId(ce.getCardControlId());
    ce.setAgentName(ce.getAgentName());
    ce.setAgentPaperNo(ce.getAgentPaperNo());
    ce.setAgentPapertype(ce.getAgentPapertype());
    ce.setBranchNo(ce.getBranchNo());
    ce.setCrtOperator(activeUser.getUserNo().toString());
	ce.setCrtDate(date);
	ce.setLastOperator(activeUser.getUserNo().toString());
	ce.setLastDate(date);
    cmr.insert(ce);
    
    VoucherVo ar=(VoucherVo) bikeService.closeBikeApp(citizenCardNo);
	return aop;	
}

	@Override
	@SystemServiceLog(description = "查询应用开通关闭记录")
	public Map<String, Object> queryAppOpenReg(HttpServletRequest request) {
		Map<String,Object> resultMap = new HashMap<String,Object>();
		String citizenCardNo = request.getParameter("citizenCardNoByAppOpen");
		String cardPCode = request.getParameter("cardPNameByAppOpen");
		logger.debug("citizenCardNo==>"+citizenCardNo);
		logger.debug("cardPCode==>"+cardPCode);
		List<AppOpenInfoVo> appOpenInfoObjList = new ArrayList<AppOpenInfoVo>();
		appOpenInfoObjList = aorm.queryAppOpenRegInfoByCitizenNo(citizenCardNo);
		//测试时使用，写死数据，不需要读卡
	//	appOpenInfoObjList = aorm.queryAppOpenRegInfoByCitizenNo("120010000004");
		logger.debug("appOpenInfoObj==>"+appOpenInfoObjList);
		resultMap.put("appOpenInfoObj",appOpenInfoObjList);
		return resultMap;
	}

	@Override
	public Map<String, Object> openAppRegister(HttpServletRequest request) throws ApplicationException {
		Map<String, Object> bikeResponseMap = new HashMap<String,Object>();
		String citizenCardNo = request.getParameter("citizenCardNo");
		String appType = request.getParameter("appType");
		String cardsn = request.getParameter("cardsn");
		String appFlag = request.getParameter("appFlag");
		logger.debug("cardsn==>"+cardsn);
		//判断应用类型
		if("M1BK".equals(appFlag)){
			//请求写卡数据
			bikeResponseMap = bikeService.openBikeApp(citizenCardNo, cardsn);
			
			bikeResponseMap.put("cardsn", cardsn);
			//需要增加响应码的判断
			bikeResponseMap.put("statusCode", "200");
			logger.debug("bikeResponseMap==>"+bikeResponseMap);
		}
		return bikeResponseMap;
	}

	@Override
	@SystemServiceLog(description = "查询卡片信息")
	public Map<String, Object> queryCardInfo(HttpServletRequest request) {
		String citizenCardNo = request.getParameter("citizenCardNo");
		logger.debug("citizenCardNo==>"+citizenCardNo);
		CardInfoAndCustomerInfo cardAndCustInfo = aorm.queryCardInfoByCitizenCardNo(citizenCardNo);
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("cardAndCustInfo", cardAndCustInfo);
		return map;
	}

	@Override
	@SystemServiceLog(description = "注册自行车会员，开通应用")
	@Transactional(rollbackFor=Exception.class)
	public Map<String, Object> executeOpenAppReg(HttpServletRequest request, String vipno, String vipcardsn, String cardsn) throws ApplicationException {
		ActiveUser activeUser = null;
		try {
			activeUser = (ActiveUser) SecurityUtils.getSubject().getSession().getAttribute("activeUser");

		} catch (UnavailableSecurityManagerException e) {
			e.printStackTrace();
			activeUser = new ActiveUser();
			activeUser.setUserName("用户");
			activeUser.setLoginName("用户");
			activeUser.setBranchName("互联网端");
			activeUser.setBranchNo("99999999");
			activeUser.setUserNo(99999999);
			activeUser.setUserId(99999999);
		}
		
		if(activeUser == null){
			activeUser = new ActiveUser();
			activeUser.setUserName("用户");
			activeUser.setLoginName("用户");
			activeUser.setBranchName("互联网端");
			activeUser.setBranchNo("99999999");
			activeUser.setUserNo(99999999);
			activeUser.setUserId(99999999);
		}
		String citizenCardNo = request.getParameter("citizenCardNoByOpenApp");
		String appFlag = request.getParameter("appFlagByOpenApp");
		String appType = request.getParameter("appTypeByOpenApp");
		String deposit = request.getParameter("depositByOpenApp");
		String recharge = request.getParameter("rechargeByOpenApp");
		Date currentTime = new Date();		
		String appStatus = "";
		AppOpenReg aorObj = aorm.queryAppOpenRegByCardNoAndFlag(citizenCardNo, appFlag);
		if(aorObj!=null){
			//修改状态
			appStatus = AppContants.APP_STATUS_OPEN;
			String operator = activeUser.getUserNo().toString();
			aorm.updateAORStatusByCardNo(appStatus,aorObj.getAppOpenregId(),operator);
		}else{
			//记录应用开通
			AppOpenReg ao = new AppOpenReg();
			ao.setCitizenCardNo(citizenCardNo);
			ao.setAppType(appType);
			ao.setAppStatus(AppContants.APP_STATUS_OPEN);
			ao.setIsDeposit(AccountContants.IS_DEPOSIT_NO);
			ao.setIsValid("1");
			ao.setValidBegin(currentTime);
		//	ao.setValidEnd();
			ao.setCrtDate(currentTime);
			ao.setLastDate(currentTime);
			ao.setOpenDate(currentTime);
			ao.setCrtOperator(activeUser.getUserNo().toString());
			ao.setLastOperator(activeUser.getUserNo().toString());
			ao.setRemark("自行车应用开通");
			aorm.insert(ao);
		}
		

		//注册会员并写入数据库
		VoucherVo certVo = bikeService.writeCardSuccess(citizenCardNo,cardsn,recharge,vipno,vipcardsn);
		
		//以下时测试数据
	//	VoucherVo certVo = new VoucherVo();
	//	certVo.setBusinessTypeName("开通自行车应用,押金和首充业务");
	//	certVo.setTransactionAmount("300.00");
	//	certVo.setTransactionAmount("300.00");
	//	certVo.setNewCitizenCardNo("110000000001");
	//	certVo.setCardType("2");
		
		
		Map<String, Object> resultMap = new HashMap<String,Object>();
		resultMap.put("title", "自行车应用开通");
		resultMap.put("certVo", certVo);
		resultMap.put("type", "openApp");
		return resultMap;
	}

	@Override
	@Transactional(rollbackFor=Exception.class)
	public Map<String, Object> executeOpenBusAppReg(HttpServletRequest request) {
		ActiveUser activeUser = null;
		try {
			activeUser = (ActiveUser) SecurityUtils.getSubject().getSession().getAttribute("activeUser");

		} catch (UnavailableSecurityManagerException e) {
			e.printStackTrace();
			activeUser = new ActiveUser();
			activeUser.setUserName("用户");
			activeUser.setLoginName("用户");
			activeUser.setBranchName("互联网端");
			activeUser.setBranchNo("99999999");
			activeUser.setUserNo(99999999);
			activeUser.setUserId(99999999);
		}
		
		if(activeUser == null){
			activeUser = new ActiveUser();
			activeUser.setUserName("用户");
			activeUser.setLoginName("用户");
			activeUser.setBranchName("互联网端");
			activeUser.setBranchNo("99999999");
			activeUser.setUserNo(99999999);
			activeUser.setUserId(99999999);
		}
		String citizenCardNo = request.getParameter("citizenCardNoByOpenApp");
		String appFlag = request.getParameter("appFlagByOpenApp");
		String appType = request.getParameter("appTypeByOpenApp");
		String deposit = request.getParameter("depositByOpenApp");
		Date currentTime = new Date();		
		AppKind akObj = akm.queryAppKindByAppFalg(AppContants.APP_FLAG_TRANSIT);
		
		//0.黑名单状态，解黑
			
		//1.先查询主账户，查询钱包记录，如果有就该写状态；没有新建一条钱包账户
		CardData cardDataObj = cdm.queryCardDataByCitizenCardNo(citizenCardNo);
		CardControl controlObj = cardControlMapper.queryCardControlByCitizenCardNo(citizenCardNo);
		String customerNo = cardDataObj.getCustomerNo();
		Personal pObj = pm.queryPersonalByCustomerNo(customerNo);
		MainAccountPersonal m = mapm.queryMainAccountPersonalByCustomerNo(customerNo);
		
		//2.查询应用开通记录，如果没有则新增应用开通记录，有就改写状态。
		String appStatus = AppContants.APP_FEE_RULE_UNIQUE_DISABLE;
		AppOpenReg aorObj = aorm.queryAppOpenRegByCardNoAndFlag(citizenCardNo, appFlag);
		if(aorObj!=null){
			//修改状态
			appStatus = AppContants.APP_STATUS_OPEN;
			String operator = activeUser.getUserNo().toString();
			aorm.updateAORStatusByCardNo(appStatus,aorObj.getAppOpenregId(),operator);
		}else{
			
			//新增记录
			AppOpenReg ao = new AppOpenReg();
			ao.setCitizenCardNo(citizenCardNo);
			ao.setAppType(appType);
			ao.setAppStatus(AppContants.APP_STATUS_OPEN);
			ao.setIsDeposit(AccountContants.IS_DEPOSIT_NO);
			ao.setCrtDate(currentTime);
			ao.setLastDate(currentTime);
			ao.setOpenDate(currentTime);
			ao.setCrtOperator(activeUser.getUserNo().toString());
			ao.setLastOperator(activeUser.getUserNo().toString());
			ao.setRemark("公交应用开通");
			if(akObj.getValidMonthNum() != null){
				ao.setIsValid(AppContants.APP_ISVALID);
				ao.setValidBegin(currentTime);
				ao.setValidEnd(CommonUtil.willDate(currentTime, akObj.getValidMonthNum()));
			}else{
				ao.setIsValid(AppContants.APP_NOVALID);
			}
			aorm.insert(ao);
		}
		//子账户的更新
		List<SubaccountPersonal> subAccountObjList = spm.querySubaccountPersonalByAppFlag(appFlag, citizenCardNo);
		for(int i=0;i<subAccountObjList.size();i++){
			SubaccountPersonal samObj = new SubaccountPersonal();
			samObj.setAccountPw(AccountContants.CARD_WALLET_INT_PASSWORD);
			samObj.setFreezeStatus(AccountContants.FREEZE_STATUS_NORMAL);
			samObj.setRemark("应用开通");
			spm.update(samObj);
		}
		
		//交易流水（无押金，暂不需要记录）
		
		//凭证记录的生成
		Cert certObj = new Cert();
		certObj.setCertNo(SequenceNumberUtil.generatorCertNo());
		certObj.setCardControlId(controlObj.getCardControlId());
		certObj.setCertType("公交应用开通凭证");
		certObj.setCardpCode(cardDataObj.getCardpCode());
		certObj.setCardTypecode(cardDataObj.getCardTypecode());
		certObj.setName(pObj.getCustomerName());
		certObj.setPaperType(pObj.getPaperType());
		certObj.setPaperNo(pObj.getPaperNo());
		certObj.setData("应用开通凭证");
		certObj.setBranchNo(activeUser.getBranchNo());
		certObj.setCrtOperator(activeUser.getUserNo().toString());
		certObj.setCrtDate(currentTime);
		certObj.setLastOperator(activeUser.getUserNo().toString());
		certObj.setLastDate(currentTime);
		certObj.setBranch(activeUser.getBranchName());
		certMapper.insert(certObj);
		
		//业务流水的生成
		Business busObj = new Business();
		busObj.setBusinessNo(SequenceNumberUtil.generatorBusinessNo());
		busObj.setCardControlId(controlObj.getCardControlId());
		busObj.setCustomerNo(pObj.getCustomerNo());
		busObj.setCardpCode(cardDataObj.getCardpCode());
		busObj.setTellerNo(activeUser.getUserNo().toString());
		busObj.setTransDate(currentTime);
		busObj.setSeqStatus(CardContants.LSZT_NORMAL);
		busObj.setCertNo(certObj.getCertNo());
		busObj.setRemark("开通公交应用");
		businessMapper.insert(busObj);

		//4.组装凭证
		CardType cardType = cardTypeMapper.queryCardTypeByCode(cardDataObj.getCardTypecode());
		VoucherVo certVo =new VoucherVo();
		certVo.setCertNo(certObj.getCertNo());
		certVo.setBusinessTypeName("开通公交应用凭证！");
	//	certVo.setCardType(cardType.getCardTypeName());
		certVo.setCardType("1");
		certVo.setNewCitizenCardNo(citizenCardNo);
		certVo.setOperator(activeUser.getUserNo().toString());
		certVo.setNet(activeUser.getBranchNo());
		certVo.setTransactionDate(DateFormatUtils.format(currentTime, "yyyy-MM-dd HH:mm:ss"));
		certVo.setDate(DateFormatUtils.format(currentTime, "yyyy-MM-dd"));
		Map<String, Object> resultMap = new HashMap<String,Object>();
		resultMap.put("title", "公交应用开通");
		resultMap.put("certVo", certVo);
		resultMap.put("type", "openAndCloseApp");
		return resultMap;
	}

	@Override
	@Transactional(rollbackFor=Exception.class)
	public Map<String, Object> executeCloseBikeAppReg(HttpServletRequest request) throws ApplicationException {
		ActiveUser activeUser = null;
		try {
			activeUser = (ActiveUser) SecurityUtils.getSubject().getSession().getAttribute("activeUser");

		} catch (UnavailableSecurityManagerException e) {
			e.printStackTrace();
			activeUser = new ActiveUser();
			activeUser.setUserName("用户");
			activeUser.setLoginName("用户");
			activeUser.setBranchName("互联网端");
			activeUser.setBranchNo("99999999");
			activeUser.setUserNo(99999999);
			activeUser.setUserId(99999999);
		}
		
		if(activeUser == null){
			activeUser = new ActiveUser();
			activeUser.setUserName("用户");
			activeUser.setLoginName("用户");
			activeUser.setBranchName("互联网端");
			activeUser.setBranchNo("99999999");
			activeUser.setUserNo(99999999);
			activeUser.setUserId(99999999);
		}
		String citizenCardNo = request.getParameter("citizenCardNoByCloseApp");
		String appFlag = request.getParameter("appFlagByCloseApp");
		String appType = request.getParameter("appTypeByCloseApp");
		
		
		//关闭应用开通表	
		AppOpenReg aorObj = aorm.queryAppOpenRegByCardNoAndFlag(citizenCardNo, appFlag);
		String appStatus = AppContants.APP_STATUS_CLOSE;
		String operator = activeUser.getUserNo().toString();
		aorm.updateAORStatusByCardNo(appStatus,aorObj.getAppOpenregId(),operator);
		
		VoucherVo certVo = bikeService.closeBikeApp(citizenCardNo);

		Map<String, Object> resultMap = new HashMap<String,Object>();
		resultMap.put("title", "自行车应用关闭");
		resultMap.put("certVo", certVo);
		resultMap.put("citizenCardNo", citizenCardNo);
		resultMap.put("appFlag", appFlag);
		resultMap.put("type", "openAndCloseApp");
		return resultMap;
	}

	@Override
	@Transactional(rollbackFor=Exception.class)
	public Map<String, Object> executeCloseBusAppReg(HttpServletRequest request) {
		ActiveUser activeUser = null;
		try {
			activeUser = (ActiveUser) SecurityUtils.getSubject().getSession().getAttribute("activeUser");

		} catch (UnavailableSecurityManagerException e) {
			e.printStackTrace();
			activeUser = new ActiveUser();
			activeUser.setUserName("用户");
			activeUser.setLoginName("用户");
			activeUser.setBranchName("互联网端");
			activeUser.setBranchNo("99999999");
			activeUser.setUserNo(99999999);
			activeUser.setUserId(99999999);
		}
		
		if(activeUser == null){
			activeUser = new ActiveUser();
			activeUser.setUserName("用户");
			activeUser.setLoginName("用户");
			activeUser.setBranchName("互联网端");
			activeUser.setBranchNo("99999999");
			activeUser.setUserNo(99999999);
			activeUser.setUserId(99999999);
		}
		
		
		
		
		
		//关闭应用开通表
		String citizenCardNo = request.getParameter("citizenCardNoByOpenApp");
		String appFlag = request.getParameter("appFlagByOpenApp");
		String appType = request.getParameter("appTypeByOpenApp");
		CardData cardDataObj = cdm.queryCardDataByCitizenCardNo(citizenCardNo);
		CardControl controlObj = cardControlMapper.queryCardControlByCitizenCardNo(citizenCardNo);
		String customerNo = cardDataObj.getCustomerNo();
		Personal pObj = pm.queryPersonalByCustomerNo(customerNo);
		Date currentTime = new Date();
		
		//凭证
		Cert certObj = new Cert();
		certObj.setCertNo(SequenceNumberUtil.generatorCertNo());
		certObj.setCardControlId(controlObj.getCardControlId());
		certObj.setCertType(CardContants.BIKE_MIX_VOUCHER);
		certObj.setCardpCode(cardDataObj.getCardpCode());
		certObj.setCardTypecode(cardDataObj.getCardTypecode());
		certObj.setName(pObj.getCustomerName());
		certObj.setPaperType(pObj.getPaperType());
		certObj.setPaperNo(pObj.getPaperNo());
		certObj.setData("应用关闭凭证");
		certObj.setBranchNo(activeUser.getBranchNo());
		certObj.setCrtOperator(activeUser.getUserNo().toString());
		certObj.setCrtDate(currentTime);
		certObj.setLastOperator(activeUser.getUserNo().toString());
		certObj.setLastDate(currentTime);
		certObj.setBranch(activeUser.getBranchName());
		certMapper.insert(certObj);
		
		//业务流水表
		Business busObj = new Business();
		busObj.setBusinessNo(SequenceNumberUtil.generatorBusinessNo());
		busObj.setCardControlId(controlObj.getCardControlId());
		busObj.setCustomerNo(pObj.getCustomerNo());
		busObj.setCardpCode(cardDataObj.getCardpCode());
		busObj.setTellerNo(activeUser.getUserNo().toString());
		busObj.setTransDate(currentTime);
		busObj.setSeqStatus(CardContants.LSZT_NORMAL);
		busObj.setCertNo(certObj.getCertNo());
		businessMapper.insert(busObj);
		
		//应用关闭
		AppOpenReg aorObj = aorm.queryAppOpenRegByCardNoAndFlag(citizenCardNo, appFlag);
		String appStatus = AppContants.APP_STATUS_CLOSE;
		String operator = activeUser.getUserNo().toString();
		aorm.updateAORStatusByCardNo(appStatus,aorObj.getAppOpenregId(),operator);
		
		
		//钱包账户冻结
		List<SubaccountPersonal> subAccountObjList = spm.querySubaccountPersonalByAppFlag(appFlag, citizenCardNo);
		for(SubaccountPersonal subAccountObj:subAccountObjList){
			subAccountObj.setFreezeStatus(AccountContants.FREEZE_STATUS_WHOLE);
			subAccountObj.setRemark("应用关闭");
			subAccountObj.setAccountStatus(AccountContants.ACCOUNT_STATUS_FROZEN);
			subAccountObj.setFreezeDate(currentTime);
			subAccountObj.setFreezeAmount(subAccountObj.getTotalBalance());
			spm.update(subAccountObj);
		}
		//余额不退
		
		//进入黑名单
		/*BlackListGen bb = blgm.queryBlackListGenBycitizenCardNo(citizenCardNo);
		Calendar c = Calendar.getInstance();
		c.setTime(currentTime);
		c.add(Calendar.DAY_OF_MONTH, 1);
		if (bb == null) {
			bb = new BlackListGen();
			bb.setCitizenCardNo(citizenCardNo);
			bb.setCityCode(CardContants.CITY_CODE);
			bb.setAppType(appType);//置黑应用类型
			bb.setBlCount(1);// 进黑名单次数
			bb.setBlReCount(0);// 解除黑名单次数
			bb.setBlReason(BlackListContants.BL_REASON_APP_LOCKING);
			bb.setAvailDate(c.getTime());// 生效日期
			bb.setBlackMode(BlackListContants.BL_BLACK_MODE_SYSTEM);// 置黑方式
			bb.setReleaseSys(BlackListContants.BL_PUBLISHING_SYSTEM_LIST_ALl);// 发布系统列表
			bb.setCurStatus(BlackListContants.BL_CUR_STATUS_TAKE_EFFECT);// 当前状态
			bb.setLastBlRcDate(currentTime);// 最后更新日期
			blgm.insert(bb);
		} else {
			bb.setBlCount(bb.getBlCount() + 1);
			bb.setBlReReason(null);// 解除黑名单原因
			bb.setRelieveDate(null);// 解除日期
			bb.setBlReason(BlackListContants.BL_REASON_APP_LOCKING);
			bb.setAvailDate(c.getTime());// 生效日期
			bb.setBlackMode(BlackListContants.BL_BLACK_MODE_SYSTEM);// 置黑方式
			bb.setReleaseSys(BlackListContants.BL_PUBLISHING_SYSTEM_LIST_ALl);// 发布系统列表
			bb.setCurStatus(BlackListContants.BL_CUR_STATUS_TAKE_EFFECT);// 当前状态
			bb.setLastBlRcDate(currentTime);// 最后更新日期
			blgm.update(bb);

		}
		
		//黑名单记录
		BlackListRc blr = new BlackListRc();
		blr.setAppType(appType);//置黑应用类型
		blr.setCitizenCardNo(citizenCardNo);// 市民卡号
		blr.setRegisterType(BlackListContants.BL_CUR_STATUS_TAKE_EFFECT);// 登记类型
		blr.setAvailDate(c.getTime());// 生效日期
		blr.setBlackMode(BlackListContants.BL_BLACK_MODE_SYSTEM);// 置黑方式 0-系统;
		blr.setBlReason(BlackListContants.BL_REASON_APP_LOCKING);// 进黑名单原因
		blr.setBlSource(BlackListContants.BL_SOURCE_ALL);// 黑名单来源
		blr.setBusinessNo(busObj.getBusinessNo());// 综合业务流水号
		blr.setRemark("公交应用关闭置黑");

		blr.setOperDate(currentTime);
		blr.setOpNetworkNo(activeUser.getBranchNo());
		blr.setTellerNo(activeUser.getUserNo().toString());

		blrm.insert(blr);*/
		
		
		//组装凭证
		CardType cardType = cardTypeMapper.queryCardTypeByCode(cardDataObj.getCardTypecode());
		VoucherVo certVo =new VoucherVo();
		certVo.setCertNo(certObj.getCertNo());
		certVo.setBusinessTypeName("关闭公交应用凭证！");
	//	certVo.setCardType(cardType.getCardTypeName());
		certVo.setCardType("1");
		certVo.setOperator(activeUser.getUserNo().toString());
		certVo.setNewCitizenCardNo(citizenCardNo);
		certVo.setNet(activeUser.getBranchNo());
		certVo.setTransactionDate(DateFormatUtils.format(currentTime, "yyyy-MM-dd HH:mm:ss"));
		certVo.setDate(DateFormatUtils.format(currentTime, "yyyy-MM-dd"));
		
		Map<String, Object> resultMap = new HashMap<String,Object>();
		resultMap.put("title", "公交应用关闭");
		resultMap.put("certVo", certVo);
		return resultMap;
	}

	@Override
	public Map<String, Object> queryBikeAppPwdInfoByCitizenNo(HttpServletRequest request) {
		String citizenCardNo = request.getParameter("citizenCardNo");
		List<BikeSection> list = bikeSectionMapper.queryBikeSection(citizenCardNo);
		Map<String, Object> map = new HashMap<String,Object>();
		map.put("key", list);
		return map;
	}

	@Override
	@Transactional(rollbackFor=Exception.class)
	public Map<String, Object> executeOpenLibAppReg(HttpServletRequest request) {
		ActiveUser activeUser = null;
		try {
			activeUser = (ActiveUser) SecurityUtils.getSubject().getSession().getAttribute("activeUser");

		} catch (UnavailableSecurityManagerException e) {
			e.printStackTrace();
			activeUser = new ActiveUser();
			activeUser.setUserName("用户");
			activeUser.setLoginName("用户");
			activeUser.setBranchName("互联网端");
			activeUser.setBranchNo("99999999");
			activeUser.setUserNo(99999999);
			activeUser.setUserId(99999999);
		}
		
		if(activeUser == null){
			activeUser = new ActiveUser();
			activeUser.setUserName("用户");
			activeUser.setLoginName("用户");
			activeUser.setBranchName("互联网端");
			activeUser.setBranchNo("99999999");
			activeUser.setUserNo(99999999);
			activeUser.setUserId(99999999);
		}
		String citizenCardNo = request.getParameter("citizenCardNoByOpenApp");
		String appFlag = request.getParameter("appFlagByOpenApp");
		String appType = request.getParameter("appTypeByOpenApp");
		String deposit = request.getParameter("depositByOpenApp");
		if("".equals(deposit)||deposit==null){
			deposit = "0.00";
		}
		String recharge = request.getParameter("rechargeByM1BK");
		if("".equals(recharge)||recharge==null){
			recharge = "0.00";
		}
		Date currentTime = new Date();		
		AppKind akObj = akm.queryAppKindByAppFalg(AppContants.APP_FLAG_LIB);
		
		
		
		
		
		
		//1.先查询主账户，查询钱包记录，如果有就该写状态；没有新建一条钱包账户
		CardData cardDataObj = cdm.queryCardDataByCitizenCardNo(citizenCardNo);
		CardControl controlObj = cardControlMapper.queryCardControlByCitizenCardNo(citizenCardNo);
		String customerNo = cardDataObj.getCustomerNo();
		Personal pObj = pm.queryPersonalByCustomerNo(customerNo);
		MainAccountPersonal m = mapm.queryMainAccountPersonalByCustomerNo(customerNo);
		
		//2.查询应用开通记录，如果没有则新增应用开通记录，有就改写状态。
		String appStatus = AppContants.APP_FEE_RULE_UNIQUE_DISABLE;
		AppOpenReg aorObj = aorm.queryAppOpenRegByCardNoAndFlag(citizenCardNo, appFlag);
		if(aorObj!=null){
			//修改状态
			appStatus = AppContants.APP_STATUS_OPEN;
			String operator = activeUser.getUserNo().toString();
			aorm.updateAORStatusByCardNo(appStatus,aorObj.getAppOpenregId(),operator);
		}else{
			
			//新增记录
			AppOpenReg ao = new AppOpenReg();
			ao.setCitizenCardNo(citizenCardNo);
			ao.setAppType(appType);
			ao.setAppStatus(AppContants.APP_STATUS_OPEN);
			ao.setIsDeposit(AccountContants.IS_DEPOSIT_NO);
			ao.setCrtDate(currentTime);
			ao.setLastDate(currentTime);
			ao.setOpenDate(currentTime);
			ao.setCrtOperator(activeUser.getUserNo().toString());
			ao.setLastOperator(activeUser.getUserNo().toString());
			ao.setRemark("图书馆应用开通");
			if(akObj.getValidMonthNum() != null){
				ao.setIsValid(AppContants.APP_ISVALID);
				ao.setValidBegin(currentTime);
				ao.setValidEnd(CommonUtil.willDate(currentTime, akObj.getValidMonthNum()));
			}else{
				ao.setIsValid(AppContants.APP_NOVALID);
			}
			aorm.insert(ao);
		}	
		
		//凭证记录的生成
		Cert certObj = new Cert();
		certObj.setCertNo(SequenceNumberUtil.generatorCertNo());
		certObj.setCardControlId(controlObj.getCardControlId());
		certObj.setCertType(AppContants.APP_STATUS_OPEN);
		certObj.setCardpCode(cardDataObj.getCardpCode());
		certObj.setCardTypecode(cardDataObj.getCardTypecode());
		certObj.setName(pObj.getCustomerName());
		certObj.setPaperType(pObj.getPaperType());
		certObj.setPaperNo(pObj.getPaperNo());
		certObj.setData("应用开通凭证");
		certObj.setBranchNo(activeUser.getBranchNo());
		certObj.setCrtOperator(activeUser.getUserNo().toString());
		certObj.setCrtDate(currentTime);
		certObj.setLastOperator(activeUser.getUserNo().toString());
		certObj.setLastDate(currentTime);
		certObj.setBranch(activeUser.getBranchName());
		certMapper.insert(certObj);
		
		//业务流水的生成
		Business busObj = new Business();
		busObj.setBusinessNo(SequenceNumberUtil.generatorBusinessNo());
		busObj.setCardControlId(controlObj.getCardControlId());
		busObj.setCustomerNo(pObj.getCustomerNo());
		busObj.setCardpCode(cardDataObj.getCardpCode());
		busObj.setTellerNo(activeUser.getUserNo().toString());
		busObj.setTransDate(currentTime);
		busObj.setSeqStatus(CardContants.LSZT_NORMAL);
		busObj.setCertNo(certObj.getCertNo());
		busObj.setRemark("开通图书馆应用");
		businessMapper.insert(busObj);
		
		//20190114鱼洲杰修改一下行
		String str = "{\"title\":\""+"图书馆应用开通凭证"+"\",\"type\":\""+"openApp"+"\",\"certNo\":\""+certObj.getCertNo()+"\",\"busType\":\""
		+CardContants.getCertTypeNameByCode(certObj.getCertType())+"\",\"cardType\":\""+certObj.getCardTypecode()+"\",\"citizenCardNo\":\""
		+citizenCardNo+"\",\"fee\":\""+deposit+"\",\"money\":\""
		+recharge+"\",\"net\":\""+activeUser.getBranchName()+"\",\"operator\":\""
		+activeUser.getUserNo().toString()+"\",\"date\":\""+DateFormatUtils.format(new Date(), "yyyy-MM-dd")+"\"}";
		certObj.setData(str);
		certObj.setTransCode("图书馆应用开通");
		certMapper.update(certObj);
		
		//4.组装凭证
		CardType cardType = cardTypeMapper.queryCardTypeByCode(cardDataObj.getCardTypecode());
		VoucherVo certVo =new VoucherVo();
		certVo.setCertNo(certObj.getCertNo());
		certVo.setBusinessTypeName("开通图书馆应用凭证！");
	//	certVo.setCardType(cardType.getCardTypeName());
		certVo.setCardType("1");
		certVo.setNewCitizenCardNo(citizenCardNo);
		certVo.setOperator(activeUser.getUserNo().toString());
		certVo.setNet(activeUser.getBranchName());
		certVo.setTransactionDate(DateFormatUtils.format(currentTime, "yyyy-MM-dd HH:mm:ss"));
		certVo.setDate(DateFormatUtils.format(currentTime, "yyyy-MM-dd"));
		certVo.setFeeBln(deposit);
		certVo.setTransactionAmount(recharge);
		Map<String, Object> resultMap = new HashMap<String,Object>();
		resultMap.put("title", "图书馆应用开通");
		resultMap.put("certVo", certVo);
		resultMap.put("type", "openApp");
		return resultMap;
	}

	@Override
	@Transactional(rollbackFor=Exception.class)
	public Map<String, Object> executeCloseLibAppReg(HttpServletRequest request) {
		ActiveUser activeUser = null;
		try {
			activeUser = (ActiveUser) SecurityUtils.getSubject().getSession().getAttribute("activeUser");

		} catch (UnavailableSecurityManagerException e) {
			e.printStackTrace();
			activeUser = new ActiveUser();
			activeUser.setUserName("用户");
			activeUser.setLoginName("用户");
			activeUser.setBranchName("互联网端");
			activeUser.setBranchNo("99999999");
			activeUser.setUserNo(99999999);
			activeUser.setUserId(99999999);
		}
		
		if(activeUser == null){
			activeUser = new ActiveUser();
			activeUser.setUserName("用户");
			activeUser.setLoginName("用户");
			activeUser.setBranchName("互联网端");
			activeUser.setBranchNo("99999999");
			activeUser.setUserNo(99999999);
			activeUser.setUserId(99999999);
		}
		
		//关闭应用开通表
		String citizenCardNo = request.getParameter("citizenCardNoByCloseApp");
		String appFlag = request.getParameter("appFlagByCloseApp");
		String appType = request.getParameter("appTypeByCloseApp");
		String deposit = request.getParameter("depositByCloseApp");
		if("".equals(deposit)||deposit==null){
			deposit = "0.00";
		}
		String recharge = request.getParameter("rechargeByM1BK");
		if("".equals(recharge)||recharge==null){
			recharge = "0.00";
		}
		CardData cardDataObj = cdm.queryCardDataByCitizenCardNo(citizenCardNo);
		CardControl controlObj = cardControlMapper.queryCardControlByCitizenCardNo(citizenCardNo);
		String customerNo = cardDataObj.getCustomerNo();
		Personal pObj = pm.queryPersonalByCustomerNo(customerNo);
		Date currentTime = new Date();
		
		//凭证
		Cert certObj = new Cert();
		certObj.setCertNo(SequenceNumberUtil.generatorCertNo());
		certObj.setCardControlId(controlObj.getCardControlId());
		certObj.setCertType(AppContants.APP_STATUS_CLOSE);
		certObj.setCardpCode(cardDataObj.getCardpCode());
		certObj.setCardTypecode(cardDataObj.getCardTypecode());
		certObj.setName(pObj.getCustomerName());
		certObj.setPaperType(pObj.getPaperType());
		certObj.setPaperNo(pObj.getPaperNo());
		certObj.setData("应用关闭凭证");
		certObj.setBranchNo(activeUser.getBranchNo());
		certObj.setCrtOperator(activeUser.getUserNo().toString());
		certObj.setCrtDate(currentTime);
		certObj.setLastOperator(activeUser.getUserNo().toString());
		certObj.setLastDate(currentTime);
		certObj.setBranch(activeUser.getBranchName());
		certMapper.insert(certObj);
		
		//业务流水表
		Business busObj = new Business();
		busObj.setBusinessNo(SequenceNumberUtil.generatorBusinessNo());
		busObj.setCardControlId(controlObj.getCardControlId());
		busObj.setCustomerNo(pObj.getCustomerNo());
		busObj.setCardpCode(cardDataObj.getCardpCode());
		busObj.setTellerNo(activeUser.getUserNo().toString());
		busObj.setTransDate(currentTime);
		busObj.setSeqStatus(CardContants.LSZT_NORMAL);
		busObj.setCertNo(certObj.getCertNo());
		businessMapper.insert(busObj);
		
		//应用关闭
		AppOpenReg aorObj = aorm.queryAppOpenRegByCardNoAndFlag(citizenCardNo, appFlag);
		String appStatus = AppContants.APP_STATUS_CLOSE;
		String operator = activeUser.getUserNo().toString();
		aorm.updateAORStatusByCardNo(appStatus,aorObj.getAppOpenregId(),operator);
		
		//20190114鱼洲杰修改一下行
		String str = "{\"title\":\""+"关闭图书馆应用凭证"+"\",\"type\":\""+"openAndCloseApp"+"\",\"certNo\":\""+certObj.getCertNo()+"\",\"busType\":\""
		+CardContants.getCertTypeNameByCode(certObj.getCertType())+"\",\"cardType\":\""+certObj.getCardTypecode()+"\",\"citizenCardNo\":\""
		+citizenCardNo+"\",\"fee\":\""+deposit+"\",\"money\":\""
		+recharge+"\",\"net\":\""+activeUser.getBranchName()+"\",\"operator\":\""
		+activeUser.getUserNo().toString()+"\",\"date\":\""+DateFormatUtils.format(new Date(), "yyyy-MM-dd")+"\"}";
		certObj.setData(str);
		certObj.setTransCode("图书馆应用关闭");
		certMapper.update(certObj);
		//组装凭证
		CardType cardType = cardTypeMapper.queryCardTypeByCode(cardDataObj.getCardTypecode());
		VoucherVo certVo =new VoucherVo();
		certVo.setCertNo(certObj.getCertNo());
		certVo.setBusinessTypeName("关闭图书馆应用凭证！");
	//	certVo.setCardType(cardType.getCardTypeName());
		certVo.setCardType("1");
		certVo.setFeeBln(deposit);
		certVo.setTransactionAmount(recharge);
		certVo.setOperator(activeUser.getUserNo().toString());
		certVo.setNewCitizenCardNo(citizenCardNo);
		certVo.setNet(activeUser.getBranchName());
		certVo.setTransactionDate(DateFormatUtils.format(currentTime, "yyyy-MM-dd HH:mm:ss"));
		certVo.setDate(DateFormatUtils.format(currentTime, "yyyy-MM-dd"));
		
		Map<String, Object> resultMap = new HashMap<String,Object>();
		resultMap.put("title", "图书馆应用关闭");
		resultMap.put("certVo", certVo);
		resultMap.put("type", "openAndCloseApp");
		return resultMap;
	}
}
